#include <iostream>
#include <thread>
#include <functional>
using std::cout;
using std::endl;
using std::thread;

void threadFunc(int arg){
    cout << "threadFunc" <<arg <<endl;
}
class Example{
public:
    void operator()(int arg){
        cout << "Example" << endl;
    }
};

void test(){
    
}

int main()
{
    //函数名
    thread th(threadFunc,1);
    // 重载了operator()的类
    Example ex;
    thread th2(ex,2);
    //匿名函数
    thread th3([](int arg){
               cout << "lambda"<< arg<<endl;
               },3);
    // function
    std::function<void(int)> func = threadFunc;
    thread th4(func,4);
    // 函数指针
    using Func = void(*)(int);
    Func func_1 = threadFunc; 
    thread th5(func_1,5);
    // bind
    thread th6(std::bind(func_1,6));

    th.join();
    th2.join();
    th3.join();
    th4.join();
    th5.join();
    th6.join();
    return 0;
}

